-
Notifications
You must be signed in to change notification settings - Fork 24.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify TransportAddress #20798
Simplify TransportAddress #20798
Conversation
since TransportAddress is now final we can simplify it's interface a bit and remove methods that are only used in tests or are plain delegates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a minor nit, it doesn't matter to me if you address it or not. LGTM.
@@ -144,8 +145,10 @@ static void log(final Logger logger, final String error) { | |||
*/ | |||
// visible for testing | |||
static boolean enforceLimits(BoundTransportAddress boundTransportAddress) { | |||
return !(Arrays.stream(boundTransportAddress.boundAddresses()).allMatch(TransportAddress::isLoopbackOrLinkLocalAddress) && | |||
boundTransportAddress.publishAddress().isLoopbackOrLinkLocalAddress()); | |||
Predicate<TransportAddress> isLoopbackOrLinkLocalAddress = (t) -> t.address().getAddress().isLinkLocalAddress() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parentheses around t
are unnecessary.
"open sesame", emptyMap()); | ||
ReindexRequestBuilder request = ReindexAction.INSTANCE.newRequestBuilder(client()).source("source").destination("dest") | ||
.setRemoteInfo(remote); | ||
assertThat(request.get(), matcher().created(1)); | ||
} | ||
|
||
public void testReindexSendsHeaders() throws Exception { | ||
RemoteInfo remote = new RemoteInfo("http", address.getHost(), address.getPort(), new BytesArray("{\"match_all\":{}}"), null, null, | ||
RemoteInfo remote = new RemoteInfo("http", address.getAddress(), address.getPort(), new BytesArray("{\"match_all\":{}}"), null, null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checkstyle is unhappy with this.
@@ -107,7 +107,7 @@ public void testReindexSendsHeaders() throws Exception { | |||
} | |||
|
|||
public void testReindexWithoutAuthenticationWhenRequired() throws Exception { | |||
RemoteInfo remote = new RemoteInfo("http", address.getHost(), address.getPort(), new BytesArray("{\"match_all\":{}}"), null, null, | |||
RemoteInfo remote = new RemoteInfo("http", address.getAddress(), address.getPort(), new BytesArray("{\"match_all\":{}}"), null, null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checkstyle is unhappy with this.
@@ -125,7 +125,7 @@ public void testReindex() throws Exception { | |||
public void testReindexFromRemote() throws Exception { | |||
NodeInfo nodeInfo = client().admin().cluster().prepareNodesInfo().get().getNodes().get(0); | |||
TransportAddress address = nodeInfo.getHttp().getAddress().publishAddress(); | |||
RemoteInfo remote = new RemoteInfo("http", address.getHost(), address.getPort(), new BytesArray("{\"match_all\":{}}"), null, null, | |||
RemoteInfo remote = new RemoteInfo("http", address.getAddress(), address.getPort(), new BytesArray("{\"match_all\":{}}"), null, null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checkstyle is unhappy with this.
since TransportAddress is now final we can simplify it's interface a bit
and remove methods that are only used in tests or are plain delegates.